﻿using EcoSystem.Enums;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Volo.Abp.Application.Services;

namespace EcoSystem
{
    /// <summary>
    /// 
    /// </summary>
    public interface IConfigSettingAppService : ICrudAppService<
        ConfigSettingDto,
        Guid,
        GetConfigSettingInput,
        CreateOrUpdateConfigSettingDto,
        CreateOrUpdateConfigSettingDto>
    {
        /// <summary>
        /// 获取配置项项信息
        /// </summary>
        /// <param name="input">参数</param>
        /// <returns></returns>
        Task<ConfigDefineAndSettingDto> GetConfigSettingAsync(GetConfigDefineAndSettingInputDto input);

        /// <summary>
        /// 获取用户配置信息
        /// </summary>
        /// <param name="input">参数</param>
        /// <returns></returns>
        Task<ConfigDefineAndSettingDto> GetUserConfigSettingAsync(GetConfigDefineAndSettingInputDto input);

        /// <summary>
        /// 保存指定分类对应的全局配置、指定系统的系统级配置或用户级配置
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        Task<bool> SaveConfigAsync(SaveSettingsInput input);

        /// <summary>
        /// 保存全部配置数据
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        Task<bool> SaveAllConfigAsync(SaveAllSettingsInput input);

        /// <summary>
        ///保存指定分类对应的用户配置数据
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        Task<bool> SaveUserConfigAsync(SaveUserSettingsInput input);

        /// <summary>
        /// 获取配置数据
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        Task<Dictionary<string, Dictionary<string, object>>> GetConfigAsync(GetSettingsInput input);

        /// <summary>
        /// 获取指定的配置键对应的配置值
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        Task<string> GetConfigValueAsync(GetConfigValueInputDto input);

        /// <summary>
        /// 保存指定的配置键值
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        Task<bool> SetConfigValueAsync(SetConfigValueInputDto input);

        /// <summary>
        /// 按分类批量删除
        /// </summary>
        /// <param name="category"></param>
        /// <returns></returns>
        Task DeleteAllAsync(string category);

        /// <summary>
        /// 删除指定键的全部数据
        /// </summary>
        /// <param name="key"></param>
        /// <returns></returns>
        Task DeleteForKeyAsync(string key);
    }
}
